<template>
	<view :style="[{paddingBottom: statusBarHeight + customBar+'px'}]">
		<view class="nav-box" :style="[{background:'linear-gradient(90deg, '+bgcolor+' 0%, '+bgGracolor+' 100%)'}]">
			<view class="nav-state" :style="[{height: statusBarHeight+'px'}]"></view>
			<view class="flex-row flex-jus-between flex-y-center nav-title" :style="[{height: customBar+'px'},{lineHeight: customBar+'px'}]">
				<view class="flex-row flex-y-center">
					<image v-if="which=='detail'" src="../../static/img/left.png" style="width: 50rpx; height:50rpx;" @click="returnHandle()"></image>
					<image v-if="which=='order'" src="../../static/img/black-left.png" style="width: 50rpx; height:50rpx;" @click="returnHandle()"></image>
				</view>
				<text :style="[{color: which=='order'?'#000':''},{fontWeight:which=='order'?'400':'600'}]">{{title}}</text>
				<view>
					<!-- <view class="flex-row flex-y-center" v-if="which=='home'">
						<image src="/static/img/home/home1.png" style="width: 50rpx;height: 50rpx;"></image>
					</view> -->
					<!-- <view v-if="isShowHome==true">
						<view class="navBtn">
							返回农场
						</view>
					</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'myHeader',
		props: {
			which: {
				type: String,
				default: ''
			},
			title: {
				type: String,
				default: ''
			},
			bgcolor: {
				type: String,
				default: '#14AC69'
			},
			bgGracolor: {
				type: String,
				default: '#84D157'
			},
			isShowHome: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				statusBarHeight: 20,
				customBar: 50
			}
		},
		created() {
			let self = this;
			uni.getSystemInfo({
				success(e) {
					self.statusBarHeight = e.statusBarHeight
					if (e.platform == 'android') {
						self.customBar = 50
					} else {
						self.customBar = 45
					}
				}
			})
			//console.log(this.customBar)
			// let res = uni.getSystemInfoSync()
			// this.statusBarHeight = res.statusBarHeight
		},
		methods: {
			returnHandle() {
				this.$emit('returnHandle')
			},
			submitHandle(){
				this.$emit('submitHandle')
			}
		}
	}
</script>

<style scoped>
	@import url("/static/css/public.css");
	.uni-navbar .uni-navbar__content {
	    border: 0 none !important;
	}
	.nav-box{
		position: fixed;
		width: 100%;
		z-index: 999;
		padding: 0 20rpx;
		box-sizing: border-box;
	}
	.nav-title{
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
	}
	.navBtn{
		width: 126rpx;
		height: 44rpx;
		background: #EFEEF1;
		border: 1px solid #999999;
		border-radius: 44rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #666666;
		line-height: 44rpx;
		text-align: center;
	}
</style>
